package plate

//车牌对齐,用于判断格式是否正确
func blueAline(initial string) (plateNo string) {
	var remain string
	var temp string
	remain, temp = theFirstIsHan(initial, handler.defProvince)
	plateNo = temp
	remain, temp = theSecondIsEnglish(remain, handler.defCity)
	plateNo = plateNo + temp + remain
	return
}

func greenAline(initial string) (plateNo string) {
	var temp string
	var remain string
	var ret bool
	_, _, ret = theFirstIsTwoHan(initial)
	if ret {
		plateNo = initial
	} else {
		remain, temp = theFirstIsHan(initial, handler.defProvince)
		plateNo = temp + remain
	}
	return
}
func yellowAline(initial string) (plateNo string) {
	var remain string
	var temp string
	remain, temp = theFirstIsHan(initial, handler.defProvince)
	plateNo = temp
	remain, temp = theSecondIsEnglish(remain, handler.defCity)
	plateNo = plateNo + temp + remain
	return
}

func blackAline(initial string) (plateNo string, color string) {

	var ret bool
	color = "黑"
	_, _, ret = theLastIsHan(initial)
	if ret {
		plateNo = initial
	} else {
		color = "蓝"
		plateNo = blueAline(initial)
	}
	return
}

//判断车牌长度是否异常
func plateNoLenIsOk(plateNo string, color string) bool {

	if color == "蓝" {
		if len(plateNo) < 9 {
			return false
		}
	} else if color == "绿" {
		if len(plateNo) < 9 {
			return false
		}
	} else if color == "黄" {
		if len(plateNo) < 9 {
			return false
		}
	} else if color == "白" {
		if len(plateNo) < 7 {
			return false
		}
	} else if color == "黑" {
		if len(plateNo) < 9 {
			return false
		}
	}

	return true
}
